<include file="Public:header" />
<style type="text/css">
    div.select-date
    {
        margin-left:35px;
    }
    div.select-date span {
        font-weight:bold;
        position: relative;
        bottom:5px;
    }
    table caption{
        font-size:20px;
        margin-bottom:15px;
        font-weight:bold;
    }
    div.confirm {
        float:right;
        margin:40px 50px 0 0;
    }
</style>
<div class="alert alert-info">
    采购清单管理
</div>
<div class="select-date">
    <span>请选择采购单的日期：</span><select name="date" onchange="changePurchase(this);">
        <volist name="allDate" id="val">
            <if condition="$_GET['date'] == $val">
                <option value="{$val}" selected>{$val}</option>
            <else />
                <option value="{$val}">{$val}</option>
            </if>
        </volist>
    </select>
</div>
<table class="table table-bordered">
    <caption>xx食堂 {$date} 采购清单</caption>
    <tr>
        <th>材料品种</th>
        <th>材料数量</th>
        <th>材料价格</th>
        <th>材料总价</th>
        <th>供货单位</th>
        <th>采购时间</th>
    </tr>
    <volist name="stuffs" id="val">
        <tr>
            <td>{$val.1}</td>
            <td>{$val.2}　{$v.3}</td>
            <td>{$val.4}</td>
            <td>{$val[2] * $val[4]|number_format='2'}</td>
            <td>{$lastPurchase.supplier_id}</td>
            <td>{$lastPurchase.purchase_date}</td>
        </tr>
    </volist>
    <tr></tr>
</table>

<if condition="$lastPurchase['is_enter'] eq 0">
    <div class="confirm"><a href="__URL__/enter/id/{$lastPurchase.id}" class="btn btn-primary" onclick="return confirm('确认后不能取消，是否确定入库？') ? true : false;">确认入库</a></div>
<else />
    <div class="confirm"><strong>该采购单已入库</strong></div>
</if>
<include file="Public:check"/>
<script type="text/javascript">
    function changePurchase(_this)
    {
        var date = $(_this).val();
        location.href = '__URL__/index/date/'+date;
    }
</script>
</body>
</html>